/*
 * main.cpp
 *
 *  Created on: Dec 12, 2013
 *      Author: killerg
 */


#include "bill_deps.h"

#include "bill.h"

#include <google/protobuf/stubs/common.h>

#include "share/util.h"

void run(SvcData* svcdata_) {
    srand(time(NULL));
    svcdata_->status = SvcData::Initing;
    if (!g_bill.init(svcdata_)) {
    	svcdata_->status = SvcData::Shutting;
    	return ;
    }
    svcdata_->status = SvcData::Running;
    g_bill.loop();
    svcdata_->status = SvcData::Shutting;
    g_bill.destroy();

    google::protobuf::ShutdownProtobufLibrary();
}

int main(int argc, char** argv) {
	return svc_ctrl(argc, argv, run)?0:-1;
}
